<div class="row">
<div class="large-12 columns">
	<?=$system_message;?>
	<div class="panel"><h6>Student Financial Records</h6></div>
	<!--  start here  -->
		<div class="row">
			<div class="large-6 columns">
				<div data-alert="" class="alert-box success"><i class="icon-ok"></i> Payment Plan : <i class="icon-asterisk"></i><?=$payment_mode;?></div>
			</div>
			<div class="large-6 columns">
				<?=$finance_status?>
			</div>
		</div>
		<div class="row">
			
		</div>
		<div>
		<br>
		<table class="table table-striped table-hover">
			<thead>
				<tr>
					<th>Name of Fee</th>
					<th>Amount</th>
					<th>&nbsp;</th>
				<tr>
			</thead>
			
			<?if($tuit_fees OR $misc_fees OR $cca_fees):?>
			<tbody>
				<!-- tuition fees-->
						<tr>
							<td colspan="3"><span class="label">Tuition Fees:</span></td>
						</tr>
				<?if(!empty($tuit_fees)):?>
					<?foreach($tuit_fees as $key => $value):?>
						<tr>
							<td class="fee_content"><i class="icon-tag"></i>&nbsp;<span class="label success"><?=$value->sef_fee_name;?></span></td>
							<td style="text-align:right;"><?=money(round(floatval($value->sef_fee_rate),2));?></td>
							<td></td>
							<?// echo $delete_link($value->sef_id,$enrollment_id,$authlink);?>
						</tr>
					<?endforeach;?>
					<?else:?>
				<?endif;?>
				<!--end tuition fees-->
				<!-- Miscellaneous fees-->
					<tr>
						<td colspan="3"><span class="label">Miscellaneous Fees:</span></td>
					</tr>
				<?if(!empty($misc_fees)):?>
					<?foreach($misc_fees as $key => $value):?>
						<tr>
							<td class="fee_content"><i class="icon-tag"></i>&nbsp;<span class="label success"><?=$value->sef_fee_name;?></span></td>
							<td style="text-align:right;"><?=money(round(floatval($value->sef_fee_rate),2));?></td>
							<td></td>
							<?// echo $delete_link($value->sef_id,$enrollment_id,$authlink);?>
						</tr>
					<?endforeach;?>
					<?else:?>
				<?endif;?>
				<!-- end registration fees-->
				
				<!-- CCA Fees-->
						<tr>
							<td colspan="3"><span class="label">CCA Fees:</span></td>
						</tr>
				
				<?if(!empty($cca_fees)):?>	
					<?foreach($cca_fees as $key => $value):?>
						<tr>
							<td  class="fee_content"><i class="icon-tag"></i>&nbsp;<span class="label success"><?=$value->sef_fee_name;?></span></td>
							<td style="text-align:right;"><?=money(round(floatval($value->sef_fee_rate),2));?></td>
							<td></td>
							<?// echo $delete_link($value->sef_id,$enrollment_id,$authlink);?>
						</tr>
					<?endforeach;?>
				<?else:?>
					<tr>
						<td colspan="3" style="text-align:center;">
							No Fees.
						</td>	
					</tr>
				<?endif;?>
				<!-- end CCA fees-->
				<?else:?>
					<tr class="info">
						<td colspan="3">
							<strong>A small error has occured. System cannot find fees set for student.</strong>
							<ul style="list-style-type:none;">
								<li>Possible Cause:</li>
								<li><i class="icon-hand-right"></i>&nbsp;Grade Level was not Assigned to a payment group.</li>
							</ul>
						</td>
					</tr>
				<?endif;?>

				
				<!-- Student Electives-->
					<tr>
						<td colspan="3"><span class="label">Additional/Optional Fees:</span></td>
					</tr>
				<?if(!empty($elec_fees)):?>
					<?foreach($elec_fees as $key => $value):?>
						<tr>
							<td class="fee_content"><i class="icon-tag"></i>&nbsp;<span class="label success"><?=$value->sef_fee_name;?></span></td>
							<td style="text-align:right;"><?=money(round(floatval($value->sef_fee_rate),2));?></td>
						</tr>
					<?endforeach;?>
				<?else:?>
				<?endif;?>
				<!-- end Student Electives-->

					<tr>
						<td colspan="3" style="text-align:center;">
							<!-- table Break--><br/>
						</td>	
					</tr>
					<tr class="bordered">
						<td>Total Applied Payment Plan:</td>
						<td>&nbsp;</td>
						<td style="text-align:right;">&#8369; <strong><?= $total_stud_deductions == 0 ? money($total_payables) : money($total_payables+$total_stud_deductions);?> </strong></td>
					</tr>
					<tr class="bordered">
						<td>Additional Fees</td>
						<td style="text-align:right;"><span style="font-size:20px;font-weight:bold;">+</span></td>
						<td style="text-align:right;">&#8369; <strong><?=money($electives_total);?> </strong></td>
					</tr>
					<tr class="noborder-btm">
						<td>
							<ul style="list-style-type:none;">
							<?if(!empty($student_scholarships)):
								$count = 1;
								foreach($student_scholarships as $sc): ?>
									<li class="items-list">	
										<?=$count.') '.ucwords($sc->scholarship_name);?>
									</li>
								<? 
								$count++;
								endforeach;?>
							<?endif;?>
							<?if(!empty($student_deductions)):?>
								<?
								$count = 1;
								foreach($student_deductions as $sd): ?>
									<li class="items-list">
										<?=$count.') '.ucwords($sd->sdr_remarks);?>
									</li>
								<? 
								$count++;
								endforeach;?>
							<?endif;?>
							</ul>
						</td>
						<td></td>
						<td style="text-align:right;">
						<ul style="list-style-type:none;">
							<?if(!empty($student_scholarships)):?>
								<? foreach($student_scholarships as $sc): ?>
									<li><i><?=money($sc->total_value_deducted);?></i></li>
								<? endforeach;?>
							<?endif;?>
							<?if(!empty($student_deductions)):?>
								<? foreach($student_deductions as $sd): ?>
									<li><i><?=money($sd->sdr_amount);?></i></li>
								<? endforeach;?>
							<?endif;?>
							</ul>
						</td>
						
					</tr>
					<tr class="noborder-top">
						<td>Deductions AND Scholarships (total) </td>
						<td style="text-align:right;"><span style="font-size:20px;font-weight:bold;">-</span></td>
						<td style="text-align:right;">&#8369;  <strong style="color:#164307;"><?=money($total_stud_deductions);?> </strong></td>
					</tr>
					<tr class="bordered">
						<td>Sub Total:</td>
						<td style="text-align:right;"><span style="font-size:20px;font-weight:bold;">=</span></td>
						<td style="text-align:right;color:#f00;">&#8369;  <strong><?php echo money(round($sum_amount_due + $electives_total,2));?> </strong></td>
					</tr>
					<tr class="bordered">
						<td>Total Amount Paid</td>
						<td style="text-align:right;"><span style="font-size:20px;font-weight:bold;">-</span></td>
						<td style="text-align:right;color:#0640AA;">&#8369;  <strong><?php echo money(round($sum_paid_fees,2));?> </strong></td>
					</tr>
					<tr class="bordered">
						<td>Total amount Due:</td>
						<td style="text-align:right;"><span style="font-size:20px;font-weight:bold;">=</span></td>
						<td style="text-align:right;color:#f00;">&#8369;  <strong><?php echo money(round(($sum_amount_due + $electives_total) - $sum_paid_fees,2));?> </strong></td>
					</tr>
			</tbody>
		</table>
		</div>
	<!--  end here  -->
</div>
</div>